---
layout: blog
---
{%- if page.type == "category" -%}
  {% include function-getCategoryMeta name=page.title %}
{%- endif -%}

{%- if page.type == "tag" -%}
  {% include function-getTagMeta name=page.title %}
{%- endif -%}

{%- capture caption -%}
  {%- case page.type -%}
  {%- when "year" -%}
    Published in {{ page.date | date: "%Y" }}
  {%- when "category" -%}
    {% if category-meta %}{{ category-meta.caption }}{% else %}{{ page.title }}{% endif %}
  {%- when "tag" -%}
    {{ page.title }}
  {%- endcase -%}
{%- endcapture -%}

{%- capture type_uri -%}
  {%- case page.type -%}
  {%- when "year" -%}
    Years
  {%- when "category" -%}
    Categories
  {%- when "tag" -%}
    Tags
  {%- endcase -%}
{%- endcapture -%}

{%- capture archive_uri -%}
  {%- case page.type -%}
  {%- when "year" -%}
    {{ site.jekyll-archives.permalinks.year | replace: ":year/", "" }}
  {%- when "category" -%}
    {{ site.jekyll-archives.permalinks.category | replace: ":name/", "" }}
  {%- when "tag" -%}
    {{ site.jekyll-archives.permalinks.tag | replace: ":name/", "" }}
  {%- endcase -%}
{%- endcapture -%}

{%- capture active_caption -%}
  {%- if page.type == "year" -%}
    {{ page.date | date: "%Y" }}
  {%- else -%}
    {{ page.title }}
  {%- endif -%}
{%- endcapture -%}

<nav class="breadcrumb">
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/blog/">Blog</a></li>
    <li><a href="{{ archive_uri | prepend: site.url }}">{{ type_uri }}</a></li>
    <li class="is-active">{{ active_caption }}</li>
  </ul>
</nav>

<div class="main">
  <h1>{{ caption }}</h1>
  {% if category-meta %}{{ category-meta.description | markdownify }}{% endif %}
  {% if tag-meta %}{{ tag-meta.description | markdownify }}{% endif %}
  <hr>
</div>
<div class="posts">
  {% for post in page.posts %}
    {% include article-preview.html article=post %}
  {% endfor %}
</div>